#!/usr/bin/sh
# systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river
# systemctl --user restart xdg-desktop-portal

# restart
waydroid session stop
vstop
sudo killall -q swaybg fcitx5 mpc dunst waydroid
riverctl spawn "vstart"

# Native vertical screen switch direction TODO 这里需要额外配置文件
# screen device: DSI-1  屏幕旋转，原生竖屏配置横屏。
riverctl spawn "wlr-randr --output DSI-1 --transform 270"
# touch screen device:
riverctl input touch-4660-43981-NYM_TCA9537-B16 map-to-output DSI-1

# TODO 这里需要额外配置文件
riverctl spawn "swaybg -i $HOME/doc/bg/arch2.png -m fill"
riverctl spawn "fcitx5 -d"

riverctl spawn "foot --server"
riverctl spawn "lf"
# riverctl spawn "nvim"
riverctl spawn "waydroid session start"

# riverctl spawn "$HOME/.local/bin/mbs-cron"

# start if not running
pgrep 'swayidle' || riverctl spawn "$HOME/.local/bin/swayidle.sh"

# pgrep 'kanshi' || riverctl spawn "kanshi"

# pgrep "gammastep" || riverctl spawn "gammastep -O 5000"

# pgrep -f 'wl-paste --watch cliphist store' || riverctl spawn "wl-paste --watch cliphist store"

pgrep 'dunst' || riverctl spawn "dunst"

# the ui and etc.
pgrep 'wob' || riverctl spawn "$HOME/.local/bin/wobd"
